package net.zoneland.greenleaf.common.worktimehelper;

import java.text.ParseException;
import java.util.Date;

/**
 * 时间段JAVABEAN
 * @作者 liyi
 */
public class TimeQuantumOfDay {
	/**
	 * 开始时间
	 */
	private String startTime;
	
	/**
	 * 结束时间
	 */
	private String endTime;
	
	public TimeQuantumOfDay(){}
	
	public TimeQuantumOfDay(String startTime,  String endTime){
		this.startTime = startTime;
		this.endTime = endTime;
	}
	
	/**
	 * 计算此时间段的持续分钟数
	 * @return
	 * @throws ParseException
	 */
	public int getMinutesOfDuration() throws ParseException {
		Date date_start = null;
		Date date_end = null;
		date_start = DateFormatUtil.formatDate(startTime);
		date_end = DateFormatUtil.formatDate(endTime);
		
		return (int)((date_end.getTime() - date_start.getTime())/(1000*60));
	}	
	
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
}
